package com.wll.store.user.controller;


import com.wll.store.common.result.Result;
import com.wll.store.user.entity.Product;
import com.wll.store.user.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.security.PrivateKey;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sdx2009
 * @since 2022-09-07
 */
@RestController
@RequestMapping("/api/product")
public class ProductController {

    @Autowired
    private ProductService productService;

    @PostMapping("/productList")
    @Cacheable(value = "product")
    public Result<?> productList(@RequestBody Product product){

        List<Product> productInfo = productService.getProductInfoByName(product.getProductName());
        return new Result<>().success("产品查询成功").put(productInfo);
    }

}
